library AssaultmanUpgrades initializer init requires LegacySystem


	private function AssaultmanSkillsCondition takes nothing returns boolean
		local integer id = GetLearnedSkill()
		return id =='A002' or  id=='A036'  or id=='A06Y' or id=='A07B'
	endfunction
	
	private function AssaultmanSkills takes nothing returns nothing
		local player p = GetOwningPlayer(GetTriggerUnit())
		local integer id = GetLearnedSkill()
		local integer i = GetConvertedPlayerId(p)
		if id=='A002' then //HEDP
			set udg_HEDP[i] = udg_HEDP[i] + 1
		elseif id=='A036' then //HEAA
			set udg_HEAA[i] = udg_HEAA[i] + 1
		elseif id=='A06Y' then
			set udg_SMAWLaunch[i] = udg_SMAWLaunch[i] - 0.1
		elseif id=='A07B' then
			call SetPlayerTechResearched( p, 'R00W', GetPlayerTechCount(p,'R00W',true)+1 )
			if GetUnitAbilityLevel(GetTriggerUnit(),'A07B')==5 then
				call ShiftMoveSpeed(GetTriggerUnit(),15.0)
				call DisplayTimedTextToPlayer(p,0.0,0.0,10.0,"Improved Stamina : Increase in movespeed by 15." )
			endif
		endif
	endfunction

	private  function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
		call TriggerAddCondition(t, Condition(function AssaultmanSkillsCondition))
		call TriggerAddAction(t,function AssaultmanSkills)
	endfunction


endlibrary